/*
A : for i in range(1,m/2) g[i*2-1]<g[i*2]>g[i*2+1]
B : for i in range(1,m/2) g[i*2-1]>g[i*2]<g[i*2+1]
*/
extern"C"{int scanf(const char*,...);int printf(const char*,...);}int n,del=0,a[int(1e5+5)],p;int isup=-1;int main(){scanf("%d",&n);scanf("%d",a+1);p=1;for(int i=2;i<=n;i++){scanf("%d",a+i);if(a[i-1]<a[i]){if(isup==1){del++;}else{isup=1;p=i-1;}}else if(a[i-1]>a[i]){if(isup==0){del++;}else{isup=0;p=i-1;}}else{del++;}}printf("%d",n-del);}